﻿// Decompiled with JetBrains decompiler
// Type: Netick.IGameEngine
// Assembly: Netick, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 6726ECA1-C773-4CF7-8952-E81B30D93B52
// Assembly location: D:\WorkSpaceDemo\UPM\NetickForUnity\Netick\Runtime\Netick.dll
// XML documentation location: D:\WorkSpaceDemo\UPM\NetickForUnity\Netick\Runtime\Netick.xml

using System.Collections.Generic;

#nullable disable
namespace Netick;

/// <summary>
/// This interface is used to integrate Netick with a game engine.
/// </summary>
public interface IGameEngine
{
  void SyncTransformsToColliders();

  /// <summary>
  /// Implements this to inform Netick about the size (in 32 bit words) of your connection meta data.
  /// </summary>
  /// <returns></returns>
  int GetConnectionMetaSizeWords();

  /// <summary>
  /// Implements this to inform Netick about the size (in 32 bit words) of your entity meta data.
  /// </summary>
  /// <returns></returns>
  int GetEntityMetaSizeWords();

  /// <summary>
  /// This is called when a new entity has been added to the simulation.
  /// </summary>
  /// <param name="entity"></param>
  void OnEntitySpawned(Entity entity);

  /// <summary>
  /// This is called when an entity has been removed from the simulation.
  /// </summary>
  /// <param name="entity"></param>
  void OnEntityDespawned(Entity entity);

  /// <summary>
  /// This is called when an unliked entity has been removed from the simulation.
  /// </summary>
  /// <param name="entity"></param>
  void OnUnlinkedEntityDespawned(Entity entity);

  /// <summary>
  /// This is used to populate the user meta data for an entity.
  /// </summary>
  /// <param name="entity"></param>
  void PopulateEntityMeta(Entity entity);

  /// <summary>
  /// This method is called on the client when it receives new entity meta data. This must be used to create/setup network entities on the client. It can be called many times not only when the data has changed.
  /// <para>Note: user entity meta data can be used for custom user data that might be used in creating entities.</para>
  /// </summary>
  /// <param name="netickMeta"></param>
  /// <param name="userMetaData"></param>
  unsafe void OnEntityMetaChanged1(NetickEntityMeta netickMeta, byte* userMetaData, int worldIndex);

  unsafe void OnEntityMetaChangedPhase2(
    NetickEntityMeta netickMeta,
    byte* userMetaData,
    int worldIndex);

  unsafe void OnEntityMetaChangedPhase3(
    NetickEntityMeta netickMeta,
    byte* userMetaData,
    int worldIndex);

  /// <summary>
  /// This is called before sending packets to the target connection.
  /// </summary>
  /// <param name="target"></param>
  void OnBeforeSend(NetworkConnection target);

  /// <summary>This is called when a full packet has been received.</summary>
  /// <param name="source"></param>
  void OnPacketReceived(NetworkConnection source);

  void OnInput();

  void OnConnectRequest(NetworkConnectionRequest request);

  void OnConnectFailed(ConnectionFailedReason reason);

  void OnPeerConnected(NetworkConnection connection);

  void OnPeerDisconnected(
    NetworkConnection connection,
    TransportDisconnectReason transportDisconnectReason);

  void OnConnectedToServer();

  void OnDisconnectedFromServer(
    TransportDisconnectReason transportDisconnectReason);

  void OnPlayerConnected(NetworkPlayer player);

  void OnPlayerDisconnected(
    NetworkPlayer player,
    TransportDisconnectReason transportDisconnectReason);

  void OnPlayerJoined(NetworkPlayerId player);

  void OnPlayerLeft(NetworkPlayerId player);

  void OnMatchListUpdate(List<Session> sessions);

  unsafe void OnReceiveData(
    NetworkConnection sender,
    byte id,
    byte* data,
    int len,
    TransportDeliveryMethod transportDeliveryMethod);
}
